package com.langsotech.studio.pojo.infodirector.treeViewer;
import java.util.List;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import com.langsotech.studio.pojo.infodirector.data.PathName;
	public class TreeViewerContentProvider implements ITreeContentProvider{
		@Override
		public Object[] getChildren(Object parentElement) {
			PathName entry = (PathName)parentElement;
			List entity = entry.getChildren();
			if(entity==null||entity.isEmpty()){
				return new Object[0];
			}
			else return entity.toArray();
		}
		@Override
		public Object getParent(Object element) {
			return null;
		}
		@Override
		public boolean hasChildren(Object element) {
			PathName entry = (PathName)element;
			List list = entry.getChildren();
			if(list ==null||list.isEmpty())
				return false;
			else return true;
		}
		@Override
		public Object[] getElements(Object inputElement) {
			if(inputElement instanceof List){
				List list = (List)inputElement;
				return list.toArray();
			}
			else 
				return new Object[0];
		}
		@Override
		public void dispose() {
		}
		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}
	}
